/**
 * @Author YuanYuan
 * @Date 2022/9/10
 * @Time 13:24
 */
public class TestDemo2 {

    public static void main1(String[] args) throws InterruptedException {
        Thread thread = new Thread(()-> {
            for (int i = 0; i < 10_0000_0000; i++) {
                //无事发生
            }
        });

        System.out.println(thread.getState());

        thread.start();

        System.out.println(thread.getState());


        thread.join();

        System.out.println(thread.getState());
    }

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()-> {
//            for (int i = 0; i < 10_0000_0000; i++) {
//                //无事发生
//            }
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        System.out.println(thread.getState());

        thread.start();

        Thread.sleep(50);
        System.out.println(thread.getState());


        thread.join();

        System.out.println(thread.getState());
    }

}
